//
//  GradeClassSelectViewController.m
//  ConghuiEducation
//
//  Created by leo on 16/9/1.
//  Copyright © 2016年 sample. All rights reserved.
//

#import "GradeClassSelectViewController.h"

@interface GradeClassSelectViewController ()

@end

@implementation GradeClassSelectViewController
@synthesize _tableView;
@synthesize type;
@synthesize dataArray;


- (void)viewDidLoad {
    self.dataArray = [NSMutableArray arrayWithCapacity:0];
    NSArray *array = nil;
    if(type == 0){
        //年级
        array = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"grades" ofType:@"plist"]];
    }else{
        //班级
        array = [[NSArray alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"classes" ofType:@"plist"]];
    }
    [dataArray addObjectsFromArray:array];
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)dealloc{
    
}

#pragma mark- UITableViewDelegate
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 50;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
    return 0;
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 0;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    return nil;
}
- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    return nil;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return [dataArray count];
}


#pragma mark- UITableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *identifier1 = @"identifier1";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier1];
    if(cell == nil){
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier1];
    }
    NSString *text = [dataArray objectAtIndex:indexPath.row];
    cell.textLabel.text = text;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

@end
